/*
 * @Descripttion: 
 * @Author: ziwei
 * @Date: 2022-09-05 11:03:57
 * @LastEditors: ziwei
 * @LastEditTime: 2022-09-06 14:48:58
 */
var lengthOfLastWord = function(s) {
    let lengthNum = 0
    for(let i=s.length-1;i>=0;i--){
        console.log(s[i])
        if(s[i]!=' '&&lengthNum==0){
            lengthNum++
        }
        if(lengthNum>0&&s[i]===' '){
            return lengthNum
        }

    }
};
lengthOfLastWord('Hello World')